<?php if (!defined('BASEPATH'))exit('No direct script access allowed');
/**
 * 帮助中心控制器
 */
class Helper extends MY_Controller {

    function __construct() {
        parent::__construct();
        $this->load->model('content_model');
        $this->load->model('cate_model');
        $this->catelist = $this->cate_model->content_cate_list(array('group'=>'help','hide'=>0));
        $this->catelist = $this->cate_model->tree($this->catelist,  $this->catelist[0]['id']);
        foreach ($this->catelist as $key=>$val){
            $this->catelist[$key]['url'] = site_url('helper/'.$val['id']);
        }
        $this->assign('cate', $this->catelist);
    }
    //首页
    function index() {
        $this->display('helper/index.html');
    }
    //详情
    function detail($type) {
        $type = $type ? $type : $this->catelist[0]['id'];
        $cate = $this->db->query("select * from tan_content_category where id = $type order by id desc limit 1")->row_array();
        $where = array();
        $where['cate_id'] = $type;
        $where['status'] = 1;
        $list = $this->content_model->getList($where);
        foreach ($list as $key=>$val){
            $list[$key]['content'] = strip_tags($val['content']);
        }
        $this->assign("cate", $cate);
        $this->assign('list', $list);
        $this->display('helper/detail.html');
    }
    
    
}
